package com.huayousoft.demo.goods.controller;

import com.huayousoft.demo.goods.entity.Goods;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhangHua
 * @date 2020/11/19 17:34
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {


    @GetMapping("/list")
        public List<Goods> list(){
            List<Goods> goodsList = new ArrayList<>();
            for (int i = 0 ;i<10; i++){
                Goods goods = new Goods();
                goods.setId((long) i);
                goods.setGoodsName("商品名称"+i);
                goods.setPrice(Float.intBitsToFloat(i));
                goodsList.add(goods);
            }
            return goodsList;

    }

}
